
/**
 * @author lipan
 * @returns undefined
 */

setInterval('fn()',1000)
function fn(){
var imgObj=document.createElement('img')
imgObj.src='star.gif'
var min=20
var max=100
var data=Math.floor(Math.random()*(max-min+1)+min)
imgObj.style.width=data+'px'
var maxLeft = (window.innerWidth || document.documentElement.clientWidth) -data
    var maxTop = (window.innerHeight || document.documentElement.clientHeight) -data
    imgObj.style.position = 'absolute' // 相当于body
    imgObj.style.left = Math.floor(Math.random()*(maxLeft-0+1)+0) + 'px'
    imgObj.style.top = Math.floor(Math.random()*(maxTop-0+1)+0) + 'px'
document.body.appendChild(imgObj)}

// 删除
function fn1(){
var sss = 0
var bodyObj = document.querySelector('body')
bodyObj.onclick = function (evt) {
    var e = evt || window.event
    // var hhl = document.createElement('div')
    var txt = document.querySelector('.txt')
    if (e.target.nodeName == 'IMG') {
        bodyObj.removeChild(e.target)
        sss++
        txt.innerText = '删除的星星有' + sss + '个'
        console.log( '11111',txt.innerText);
        txt.innerHtml = txt
    }
}}
fn1()

// 血管定时器
setInterval(function(){
    var num = parseInt(document.querySelector('.hhb').style.width)
    num--
    document.querySelector('.hhb').style.width=num+'%'



},1000)
